package com.example.sources.jdbc.tool;

import java.util.List;

/**
 * Created by Administrator on 2016/9/20.
 */
public class TypeUtil {
    public static String[] baseTypes = {"java.lang.Integer",
            "java.lang.Double",
            "java.lang.Float",
            "java.lang.Long",
            "java.lang.Short",
            "java.lang.Byte",
            "java.lang.Boolean",
            "java.lang.Character",
            "java.lang.String",
            "int","double","long","short","byte","boolean","char","float"};

    public static boolean isBaseType(String returnType){
        for (String type: baseTypes){
            if (type.equals(returnType)){
                return true;
            }
        }
        return false;
    }

    public static boolean isIterable(String returnType){

        try {
            Class c = Class.forName(returnType);
            return List.class.isAssignableFrom(c);

        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }

        return false;
    }
}
